home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / ARCHIVE / DWARCS12.ZIP;1 / DWARCS.DOC < prev    next >
Encoding:
Text File  |  1993-04-01  |  8.5 KB  |  219 lines

  1.                               DWArcs version 1.2
  2.                           Written by James R. Davis
  3.                    (C) Copyright 1993 - All Rights Reserved
  4.  
  5. While writing a program one day I came across a need for reading in filenames
  6. contained within archives.  This PowerBASIC library is something I whipped up
  7. in order to fulfill that need.  It contains only 4 routines and one variable
  8. but I'm sure you'll find this to be a very helpful addition to your PowerBASIC
  9. toolbox.
  10.  
  11.                                 PRELIMINARIES
  12.                                 -------------
  13.  
  14. You should find the following files in this archive:
  15.  
  16.              DWADEMO.BAS  - Demo source for using the library
  17.              DWARCS.DOC   - This doc file
  18.              DWSRC.EXE    - For registered users
  19.              DWARCS.SRC   - Data for DWSRC.EXE
  20.              DWARCS2F.PBU - PBU for PB 2.10f
  21.              DWARCS3A.PBU - PBU for PB 3.00a
  22.              DWARE.DOC    - Complete list of DavisWARE available
  23.              FILE_ID.DIZ  - Description file for BBS's
  24.              ORDER.FRM    - Form for registering this program
  25.  
  26. If any of these files are missing, you can call my BBS the Programmer's
  27. Mega-Source at (516) 737-4637 and get the latest version.
  28.  
  29. At this time, this library handles the following archive formats:
  30.  
  31.                       ARC - PKARC up to version 5.10
  32.                       ARJ - ARJ up to version 2.39a BETA
  33.                       LZH - LHARC up to version 1.13c
  34.                       PAK - PKPAK up to version 2.51
  35.                       ZIP - PKZIP up to version 2.04G
  36.                       ZOO - ZOO up to version 2.1
  37.  
  38. If you find an archive format not supported here, let me know and I'll try to
  39. work it into the next version.
  40.  
  41. The following PBU's included with this program are for the different
  42. PowerBASIC versions:
  43.  
  44.                 DWARCS2F.PBU - For version 2.10f of PowerBASIC
  45.                 DWARCS3A.PBU - For version 3.00a of PowerBASIC
  46.  
  47. A version for 3.00b of PowerBASIC will be released soon.
  48.  
  49. Now on to the library.  See the demo program for actual program use and for
  50. more extensive examples.  There are 3 Functions, 1 Subroutine and 1 Variable
  51. that this library can handle.  Here's the descriptions:
  52.  
  53.  
  54.                                  DESCRIPTIONS
  55.                                  ------------
  56.  
  57. -------------------------------------------------------------------------------
  58.  Net%   VARIABLE  Set to non-zero if working on a remote terminal of a network
  59. -------------------------------------------------------------------------------
  60. This variable when set to a non-zero number, will tell the rest of the
  61. functions that the program is running on a remote terminal of a network.
  62. This is accomplished simply by removing the drive letter from file names
  63. specified.  When you set this variable, routines within the library will
  64. automatically do this for you.  NOTE: You must declare this variable as PUBLIC
  65. in your source code.
  66.  
  67. Syntax:  Net% = -1
  68.  
  69. Example:
  70.  
  71.   PRINT "Is this program running on a remote terminal of a network? (Y/n): ";
  72.   A$ = INPUT$(1)
  73.   A$ = UCASE$(A$)
  74.   IF A$ = "N" THEN
  75.     Net% = 0
  76.     PRINT "N"
  77.   ELSE
  78.     Net% = -1
  79.     PRINT "Y"
  80.   END IF
  81.  
  82.  
  83. -------------------------------------------------------------------------------
  84.  ArcFiles%()  FUNCTION  Returns number of files in an archive
  85. -------------------------------------------------------------------------------
  86. This function will return the total number of files within the archive name
  87. passed to it in File$.  Will return -1 if archive file does not exist, -2 if
  88. file is not an archive supported.
  89.  
  90. Syntax:  A% = ArcFiles%(File$)
  91.  
  92.          Where File$ = The file name with or without drive and path of the
  93.                        archive you wish to get the information from.
  94.  
  95. Example:
  96.  
  97.   A$ = "C:\TEMP\TEST.ZIP"
  98.   A% = ArcFiles%(A$)
  99.   IF A% = -1 THEN
  100.     PRINT A$;" does not exist!"
  101.   ELSEIF A% = -2 THEN
  102.     PRINT A$;" is not supported!"
  103.   ELSE
  104.     PRINT "There are ";LTRIM$(STR$(A%));" file(s) in ";A$
  105.   END IF
  106.  
  107.  
  108. -------------------------------------------------------------------------------
  109.  ArcDir$()  FUNCTION  Returns first/subsequent filenames in archive
  110. -------------------------------------------------------------------------------
  111. This function acts like DIR$("*.*") in that it returns a the first filename
  112. within the archive specified in File$.  Any subsequent calls to this routine
  113. will return the next filename found in the archive.  ArcDir$ will return a
  114. null string if the archive does not exist, is not a supported archive or the
  115. last filename has been found in the archive.
  116.  
  117. Syntax:  A$ = ArcDir$(File$)
  118.  
  119.          Where File$ = Is the name with or without drive and path of the
  120.                        archive in which to use.
  121.  
  122. Example:
  123.  
  124.   F$ = "C:\TEMP\TEST.ZIP"
  125.   A$ = ArcDir$(F$)
  126.   IF A$ = "" THEN
  127.     PRINT F$;" does not exist or is not supported!"
  128.   END IF
  129.   WHILE A$ <> ""
  130.     PRINT A$
  131.     A$ = ArcDir$(F$)
  132.   WEND
  133.  
  134.  
  135. -------------------------------------------------------------------------------
  136.  ArcInfo()  SUBROUTINE  Returns specific data about file within an archive
  137. -------------------------------------------------------------------------------
  138. This subroutine will search an archive for filename.  If found the file's
  139. date, time, size and compressed size will be returned.  Otherwise, if not found, null
  140. strings will be returned.
  141.  
  142. Syntax:  CALL ArcInfo(File$,Arc$,FileDate$,FileTime$,FileSize$,CompSize$)
  143.  
  144.          Where File$     = The archive filename to use, can contain a drive
  145.                            and/or path.  If filename does not exist or is not
  146.                            supported, File$ will be set to a null string.
  147.                Arc$      = The file within the archive to get information for.
  148.                            If Arc$ is not found, all stirngs will be set to
  149.                            a null string. (eg: A$ = "")  Must not contain a
  150.                            drive or pathname.
  151.                FileDate$ = The file date of Arc$ in MM-DD-YY format
  152.                FileTime$ = The file time of Arc$ in HH:MMa format
  153.                FileSize$ = The actual file size before compression
  154.                CompSize$ = The file size after compression
  155.  
  156.          Note: The file sizes are contained in strings to avoid having to
  157.                assign a specific variable type to the function.  Use VAL() to
  158.                get the sizes into a variable after calling the subroutine.
  159.  
  160. Example:
  161.  
  162.   F$ = "C:\TEMP\TEST.ZIP"
  163.   A$ = "TEST.DOC"
  164.   FF$ = F$
  165.   CALL ArcInfo(FF$, A$, FD$, FT$, FS$, CS$)
  166.   IF FF$ = "" THEN
  167.     PRINT F$; " does not exist or is not supported!"
  168.     END
  169.   END IF
  170.   IF FD$ = "" THEN
  171.     PRINT A$; " does not exist in "; F$
  172.   ELSE
  173.     PRINT A$, FS$, CS$, FD$; " "; FT$; " ";
  174.     PRINT USING$("###%", 100 - INT((100 / VAL(FS$)) * VAL(CS$)))
  175.   END IF
  176.  
  177.  
  178. -------------------------------------------------------------------------------
  179.  SearchArc%()  FUNCTION  Will search an archive for a specified filename
  180. -------------------------------------------------------------------------------
  181. This function will allow you to search an archive for a specified filename.
  182. If the filename was found in the archive, this function will return a non-zero
  183. number, or 0 if the filename was not found.  This function does not check to
  184. see if the archive exists.
  185.  
  186. Syntax:  A% = SearchArc%(File$, Search$)
  187.          Where File$   = The filename and/or drive and path fo the archive to
  188.                          search.  This function does not check to see if this
  189.                          file exists.
  190.                Search$ = Is the filename to search for within the archive.  If
  191.                          it is found, a non-zero number is returned.  If not,
  192.                          0 is returned.
  193.  
  194. Example:
  195.  
  196.   F$ = "C:\TEMP\TEST.ZIP"
  197.   A$ = "FILE_ID.DIZ"
  198.   A% = SearchArc%(F$, A$)
  199.   IF A% THEN
  200.     PRINT A$; " exists within ";F$
  201.   ELSE
  202.     PRINT A$; " does not exist within "; F$
  203.   END IF
  204.  
  205.  
  206.                                  REGISTRATION
  207.                                  ------------
  208.  
  209. Well, that about does it for the library... pretty simple right?  Thought so.
  210. If you find this library of use, and would like the source code, the
  211. registration fee for this program is $15.  Use the ORDER.FRM included with
  212. this library to register this library for a license to use it in your
  213. programs.  If you have problems or questions about this library, call the
  214. Programmer's Mega-Source BBS at (516) 737-4637.  Have fun and keep on
  215. programming!
  216.  
  217.                        -=> James "The Garf!" Davis! <=-
  218.  
  219.